package com.richinfo.service;


import com.richinfo.entity.LoginToken;
import com.richinfo.mapper.LoginTokenMapper;
import com.richinfo.mapper.SysuserMapper;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@SuppressWarnings("rawtypes")
public class LoginTokenService {
    private static Logger logger = Logger.getLogger(LoginTokenService.class);

    @Autowired
    private LoginTokenMapper loginTokenMapper;

    @Autowired
    private SysuserMapper sysuserMapper;

    public String queryTokenByUserName(String userName){
        return loginTokenMapper.queryTokenByUserName(userName);
    }


    public LoginToken queryToken(String uid) {
        LoginToken loginToken = null;
        try {
            Map<String, Object> tokenMap = new HashMap<>();
            tokenMap.put("uid",uid);
            loginToken=loginTokenMapper.findToken(tokenMap);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return loginToken;
    }



}
